<h2><?php echo $this->title; ?></h2>
<?php echo $this->form; ?>
<hr />
<p><a class="button" href="<?php echo $this->baseUrl(); ?>/user/registrationuser">Add user</a></p>
<hr />
<ul>
<?php if($this->users != null) {?>    
    <?php foreach($this->users as $user) {?>
    <li class="userlistitem 
        <?php if($user->DeletedDate != null){ 
            echo "deleted";
        }
        else if($user->ActiveDate != null && date($user->ActiveDate) > time()){ 
            echo "notActive";
        }
        else{
            echo "notDeleted";
        }
    ?>">
        <a href ="" id="">
            <?php echo $user->Fullname; ?>             
            <a href="<?php echo $this->baseUrl(); ?>/user/edit/id/<?php echo $user->Id ?>"><img src="<?php echo $this->baseUrl(); ?>/styles/assets/edit.png" /></a>
            </a>
            <ul>
                <li>Role: 
                   <?php echo $user->Role->Name ?>
                </li>
                <li>E-mails:
                <?php
                    if($user->Emails == null)
                    {
                        echo 'No other e-mails';                          
                    }
                    else
                    {
                        $user_emails    = array();
                        foreach($user->Emails as $Email)
                        {
                            $user_emails[]  = $Email->Email;
                        }
                        
                        echo implode(", ", $user_emails);
                    }
                ?>   
                </li>
                <li>Courses:
                <?php
                     if($user->Courses == null)
                    {
                        echo ' no courses';                          
                    }
                    else
                    {
                        $user_courses   = array();
                        foreach($user->Courses as $Course)
                        {
                            $user_courses[] = $Course->Name;
                        }
                        
                        echo implode(", ", $user_courses);
                    }
                ?>    
                </li>
                <li>PM: <a href="<?php echo $this->baseUrl(); ?>/message/new/to/<?php echo $user->Id ?>">Verstuur een PM</a></li>
                <!--<li>Active: 
                   <?php /*if($user->Active == '0')
                    {
                      echo ' False';                          
                    }
                    else
                    {
                        echo ' True';                                                  
                    }
                   */?>                    
                </li>-->
                <!--<li>Deleted: 
                   <?php /*$if($user->Deleted == '0')
                    {
                        echo 'No';                          
                    }
                    else
                    {
                        echo 'Yes';                                                  
                    }
                   */?>                    
                </li>-->
                
            </ul>
        </a>            
    </li>
    <?php } ?>
<?php } ?>
</ul>
<hr />
